package com.example.development.jvmStudy.oom;

/**
 * @author: vince_zww
 * @date: 2020/9/5 11:17
 * @desceription: 模拟Metaspace内存溢出 并分析解决
 *
 *
 * JVM启动参数：-Xss1M -XX:+PrintGCDetails -Xloggc:stackgc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./ -XX:+UseParNewGC -XX:+UseConcMarkSweepGC
 * 解决：检查日志，发现Exception in thread "main" java.lang.StackOverflowError定位代码，
 * 比较简单
 */
public class JavaStackOOMSolve {

    public static long counter = 0;

    public static void main(String[] args) {
        work();
    }

    public static void work(){
        System.out.println("目前是第" + (++counter) + "次调用方法");
        work();
    }
}
